package api_servers
{
	import UIFree.uif_Timer;
	
	import flash.events.Event;
	
	public class pjf_externalCap extends api_externalserver {
		public function pjf_externalCap(a_sroot: Object) {
			var a_vars: Object = a_sroot.stage.loaderInfo.parameters;
			super(a_sroot, '', a_vars["viewer_id"], a_vars["app_id"], '');
			vars = a_vars;
		}
		
		protected function capQuery(obj: Object, _handle: Function): void {
			new uif_Timer(10, null, function(e: Event): void {
				_handle(obj);
			}, 1);
		}
		
		public static function defaultUser(a_uid: int=0): Object {
			return {
	    			uid			: a_uid,
	    			first_name	: 'anonimus',
	    			last_name	: 'anonimus',
	    			nick		: 'anonimus',
	    			sex			: 1,
	    			birthday	: '01.01.2010',
	    			has_pic		: 1,
	    			pic			: pi_servers.EMPTYIMAGEURL(),
	    			pic_small	: pi_servers.EMPTYIMAGEURL(),
	    			pic_big		: pi_servers.EMPTYIMAGEURL()
	    		}
		}

	    override public function getProfiles(uids: String, handler_:*, fields: String='', queryID:String=''): void {
	    	var list: Array = new Array();
	    	var a_uids: Array = uids.split(',');
	    	for (var i:int=0; i<a_uids.length; i++)
	    		list.push(defaultUser(a_uids[0]));
	    	capQuery(list, handler_);
	    }

	    public function getAlbums(uids: String, handler_:*, fields: String='', queryID:String=''): void {
	    	capQuery([], handler_);
	    }

	    public function getPhotos(uid: String , aid: String, handler_:*, fields: String='', queryID:String=''): void {
	    	capQuery([], handler_);
	    }
	}
}